using System;
using System.Collections.Generic;
using SouthernLand.Common.DAL.NhaDat;

namespace SouthernLand.Common.BOL.NhaDat
{
    public class Loaitin
    {
        #region Public Properties

        public Int32 LoaitinID { get; set; }

        public String TenLoaitin { get; set; }

        public String TenLoaitin_en { get; set; }

        #endregion

        #region public static Methods

        public static string GetTenLoaiTinByID(int ID)
        {
            try
            {
                Loaitin obj = GetLoaitinByID(ID);
                return Globals.GetLang(obj.TenLoaitin, obj.TenLoaitin_en);
            }
            catch
            {
                return "";
            }
        }

        public static int Insert(Loaitin obj)
        {
            var db = new LoaitinDAL();
            return db.Insert(obj);
        }

        public static bool Update(Loaitin obj)
        {
            var db = new LoaitinDAL();
            return db.Update(obj);
        }

        public static bool Delete(Int32 LoaitinID)
        {
            var db = new LoaitinDAL();
            return db.Delete(LoaitinID);
        }

        public static Loaitin GetLoaitinByID(Int32 LoaitinID)
        {
            var db = new LoaitinDAL();
            return db.GetLoaitinByID(LoaitinID);
        }

        //Get All Loaitin
        public static List<Loaitin> GetAllLoaitin()
        {
            var db = new LoaitinDAL();
            return db.GetAllLoaitin(1, 10000);
        }

        //Get All Loaitin
        public static List<Loaitin> GetAllLoaitin(int PageIndex, int PageSize)
        {
            var db = new LoaitinDAL();
            return db.GetAllLoaitin(PageIndex, PageSize);
        }

        // Get Count All records of Table  Loaitin
        public static int GetCountLoaitin()
        {
            var db = new LoaitinDAL();
            return db.GetCountLoaitin();
        }

        #endregion
    }
}